package com.springboot.sba.D7_SSE;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
@RequestMapping("/sse")
public class ServerSendEvent {

    @RequestMapping(value = "/sseTest", produces = "text/event-stream;charset=UTF-8")
    public String test() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "data:xdclass 行情" + Math.random() + "\n\n";
    }
}
